import { defineStore } from 'pinia';
import { useBasicStore } from "./role-basic"
import { useEquipStore } from "./equipment"
import { useSkillStore } from "./skill"
import { ROLE_INIT_INFO } from "mock/sys/role" //需要在tsconfig.json中配置

type TProfession = 'warrior' | 'mage' | 'warlock';

// 角色组，汇聚「人物属性、装备、技能」3个store统一管理
export const roleStore = defineStore('role', () => {
  // 注册组内store
  const basicT = useBasicStore();
  const equipmentT = useEquipStore();
  const skillT = useSkillStore();

  // 转职业
  function changeProfession(profession: TProfession) {
    console.log(profession,'---------basic-------');
    basicT.setData(ROLE_INIT_INFO[profession].basic);
    equipmentT.setData(ROLE_INIT_INFO[profession].equipment);
    skillT.setData(ROLE_INIT_INFO[profession].skill);
  }

  return { basicT, equipmentT, skillT, changeProfession };
});

